package com.net.xpay.common.manager.impl.admin.rbac;

import com.google.common.base.Preconditions;
import com.net.common.annotation.ReadTransactional;
import com.net.common.dao.BasicMapper;
import com.net.common.manager.AbstractManager;
import com.net.xpay.common.dao.admin.rbac.PermissionMapper;
import com.net.xpay.common.domain.admin.rbac.Permission;
import com.net.xpay.common.manager.admin.rbac.PermissionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
@ReadTransactional
public class PermissionManagerImpl extends AbstractManager<Permission> implements PermissionManager{

    @Autowired
    private PermissionMapper mapper;


    @Override
    protected BasicMapper<Long, Permission> getMapper() {
        return mapper;
    }

    @Override
    public List<Permission> findByAdminUserId(Long adminUserId) {
        Preconditions.checkArgument(adminUserId != null);
        return nonEmptyList(mapper.findByAdminUserId(adminUserId));
    }
}
